﻿namespace com.crownpack
{
    using System.Linq;

    using com.crownpack.ExportConfigurationDao;
    using com.crownpack.SharePoint;

    using Microsoft.SharePoint;

    using ReferenceDao = ExportConfigurationDao.ExportConfigurationDao;

    using ReferenceObject = ExportConfigurationDao.ExportConfiguration;

    public class ExportConfiguration_Definition_WebLevel : CustomBaseDefinition
    {
        #region Constructors

        public ExportConfiguration_Definition_WebLevel( SPFeatureReceiverProperties properties )
            : base(properties)
        {
        }

        ~ExportConfiguration_Definition_WebLevel( )
        {
            Dispose( false );
        }

        #endregion Constructors

        #region Methods

        public override void Create( )
        {
            base.Create( );
            CreateList( getListDefn( ) );
        }

        public override void Delete( )
        {
            base.Delete( );
            DeleteList( getListDefn( ), false );
        }

        ListDefn getListDefn( )
        {
            return new ListDefn
            {
                RootFolderName = ReferenceDao.ListName,
                Title = "Crown Export Configuration",
                Description = "Contains configuration definitions for incremental and full exports.",
                ContentTypes = new string[ ]
                {
                    Item.GetContentTypeName<ReferenceObject>( )
                }.ToList( )
            };
        }

        #endregion Methods
    }
}